/*
 * Bool.cpp
 *
 *  Created on: 27/dic/2010
 *      Author: computer
 */

#include "Bool.h"

#include "Bool.h"
#include <sstream>

namespace TreeExpression {

Bool::Bool(bool _data) : Expression_CRTP<Bool>(), data(_data) { }

Bool::Bool(const Bool& copy) : Expression(copy), Expression_CRTP<Bool>(copy) {
	data = copy.data;
}

Bool::~Bool() { }

AutoPointer<Expression> Bool::eval(CopyPointer<Context>&) {
	return AutoPointer<Expression>(new TreeExpression::Bool(*this));
}

bool Bool::getData() const {
	return data;
}


std::string Bool::getHash() const {
	return "Bool";
}

std::string Bool::toString() const {
	std::ostringstream oss;
	if (data) oss << "true";
	else oss << "false";
	return oss.str();
}

}

